﻿package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2021000118678832";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCK0vbDIWNvUrS/ej3swd1l7j3rLkuaMu01ozKtKXKN9P3hErVbkunU+WYEmtx88jGTPg7wkG8ImUTj+sV34leXXNfzGGvyP/4bdSPCRhmh+vTcG3zfLd9tvAxYILmUAEjq4aY5Q8QYWWoS2w6qprhMbdPI1LfiGYGUGWqpevRMVvxAHbKw8fXw9zQyv1Ddf8tvN9eEJ+WuEEBtTwtpNg0r7adtdutLQlS+7+FWEDhJQ47HcPFa7kVPEEVJQ/CC8RPvXF+ex/algQr2zhJ1PK9RYBIBrlLgMVTkMd1HutLtUy0xf4g8KOnPaJCwfpBpgWSdDGtEOeVPsxnTywW8XmsVAgMBAAECggEAHUJruiLuZ0dCS11DcgRGWraFHG2Mh7qWHokAJFkpCNyLKgYcbWmgmT/bjbrqH/eYFVWuJmv6yxAq4fY36pWtKnzqExWhotR0BWuCFu9ZdbeEJmQwxIVRozpQS77R/my08bSPqWAsE4m8/q5m//bVv14iliCnhSMlGYbl4UTF+tTG35HbZ6y9tWCxhxuvMI2cJz+lSGg9jTFvTiy875/rajrKQcf7BtFtCvYVwNCkZX3HJviHcvSVqUY1YMnAbo4P0nRgvYk7cQy62iSa8f/YjsCAooDXUiTf1bs9pMXHYxLOVdKl81coXLDbQ3sykPpyWRXsZrYplcc+A5AdF87wwQKBgQDNmrQKw67st+HM7vS06XnNEVQ41zCbFtgfg1/rUqdCRU9viRXkEVZ0s2D9rmY9eUyayuuztU+A0kZ6BoCQp4Kzqjihwv3Y7sRbguuulUaXlVDcrfk5UGR4ykK5TU82D7jsAa0rtOmeeR9HoXLbD0gRYLtL/o1nm3dmZnzHjwBu8QKBgQCs2ewmLyBaaj6yfrkp82Di3bLBnCDJwggGh5iEcGQllNOyQbVItUB7a75SOevTExbDRGE9zgWnHWZjU4iLuD7xQ8hxco7iWLbxHk7KIVT9wifecWOOhoLuU6ny6598Aka8dVvdKvyUfZwchF8NNyPlBuYjnZ9KM4EcoBpbKikGZQKBgQDHdV9YWgHmz3SUdPScVSu+TyNfiRM0QXMlDzQMfMCaP9cSIvFDsbYnvKVJNNkmpfg06srCKhCYrmWEl649puPbHDWYaCwPOYLwLBAr69Dx2P77NyNiAKWXsNAOJ/vCPHpvKikvD3DcNjCsMunTrf2CLk9FKAtSCbZJdv9yMT6AYQKBgBNuH8yfCY0AWnHoKtpbYG3ALCL1cP4dEJfjUDK7C5bp5u4n0sAMl+YH04octrSwdaOXoTK4YQxLEsJhlnzWRkUKsJKIJSWugUoTdRnlq08nLyIjLuTLnBY8U2NaN0BSZS80JhJzjZcHk6/k9WZf52oMX3xrcId/yKi2GqBa2ee9AoGAU/1gXEVlhYWsuif94tbkhxuXHhIUArLdupST5j235Oqxnf2D5869H7cv4tdfSi96Bkiql1rECkKQmNnmHknGUyvqFOFxmg3tRDXPVFS/1eKCeNRta5dBzhYLX96lPHYstQ5ZAYM2Ls/VrGqyRZNXKTWavBP/rT8p22wy9328eHs=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAojm0PeVhAfFja6Q5X1UNMW+rHbUP/W+DB2mXUx7+Usc5dnc3ccvxqSz6Bwhh1JD67Ba+NeUfbW6VqEfDTFK/lqcmBsYnV0vqXnyU6+j5rW4+g0nifMgPbBpTXEUEtfHzOSae3aP65Fw67SWyyQrJpHWUyd8BtTfU9ELIPjua8mVW3DLR6utb/qRgVmvoZN+hxRk4WV/v0IQE0QisqwHImQft/qAZt21LTTW0uX/CT/9EYDksmuznuX1aBykngqvzS3WanW8ApWKH7WHVF9xL6jd4k0A45EBTji9FsaleJTjz6IbQ8X0beU8cS1RFjdlSXdnKTxSKwoIPdCFjF8fbrwIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://127.0.0.1:8080/gamestore/front/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://127.0.0.1:8080/gamestore/front/fukuanchenggong.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "D:\\Xxxx\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

